package MTT::Form::Register;

use HTML::FormHandler::Moose;
extends 'HTML::FormHandler::Model::DBIC';
with 'HTML::FormHandler::Render::Table';
use namespace::autoclean;

use utf8;

has '+item_class' => ( default => 'User' );
has '+action' => ( default => '/users/register' );

has_field 'username' => ( type => 'Text', label => 'Имя пользователя', required => 1 );
has_field 'email'	 => ( type => 'Email', label => 'Адрес e-mail', required => 1 );
has_field 'password' => ( type => 'Password', label => 'Пароль', required => 1 );
has_field 'password2' => ( type => 'Password', label => 'Подтвердите пароль', required => 1, noupdate => 1 );
has_field 'fio' => ( type => 'Text', label => 'ФИО', required => 1 );
has_field 'inner_phone' => ( type => 'Text', label => 'Внутренний телефон' );
has_field 'phone' => ( type => 'Text', label => 'Телефон' );
has_field 'department' => ( type => 'Text', label => 'Отдел' );
has_field 'role' => ( type => 'Select', label => 'Роль' );
has_field 'comment' => ( type => 'TextArea', label => 'Комментарий', cols => '77' );
has_field 'submit' => ( type => 'Submit', value => 'Сохранить' );

sub options_role {
	return (
		1 => 'Пользователь',
		0 => 'Администратор' 
	);
}


__PACKAGE__->meta->make_immutable;
1;

